<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="css.css">
</head>
<body>

    <button onclick="a('red')">红色</button>
    <button onclick="a('yellow')">黄色</button>
    <button onclick="a('blue')">蓝色</button>

    <input type="color" onchange="color_diy(this)">

    <script>

       function a(a) {
           document.querySelector("body").style.background=a;
       }
        function color_diy( a) {
            console.log(a.value)
            document.querySelector("body").style.background=a.value;
        }
    </script>
</body>
</html>